<template>
    <div>
        <p v-if="flag" :id="PId">{{msg}}</p>
        <p v-else>{{msg2}}</p>

        <button @click="changeMsg">切换</button>
    </div>

</template>

<script >
export default{
    data (){
        return{
            msg : "hello vue",
            msg2 : "hello world",
            flag : true,
            PId : "pId1"
        }
    },

    methods:{
        changeMsg(){
            this.flag = !this.flag;
        }
    }
}
</script>


<style scoped>
</style>